package org.xixilala.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
public class IndexController {

    @RequestMapping(value = "/index/login")
    public String login() {
        return "/sub/login";
    }

    @RequestMapping(value = "/index/register")
    public String register(Model model) {
        model.addAttribute("success","register success");
        return "register";
    }

    @RequestMapping(value = "/index/testsession")
    public String testsession(HttpSession session, HttpServletRequest request, HttpServletResponse response) {
        session.setAttribute("skey","sessionValue");
//        session.setAttribute("rkey","requestValue");
        response.setHeader("testHeader","1321");
        return "testsession";
    }
}
